﻿<UserControl x:Class="Songhay.BiggestBox.Desktop.Modules.Views.SvgFontView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    mc:Ignorable="d"
    xmlns:rxSharedModels="clr-namespace:Songhay.BiggestBox.Portable.Shared.Models;assembly=Songhay.BiggestBox.Portable.Shared"
    xmlns:vc="clr-namespace:Songhay.ValueConverters;assembly=Songhay.Mvvm"
    xmlns:vm="clr-namespace:Songhay.BiggestBox.Desktop.Modules.ViewModels"
    d:DesignWidth="{x:Static rxSharedModels:AppScalars.ModuleWidth}" d:DesignHeight="{x:Static rxSharedModels:AppScalars.ModuleHeight}">
    <UserControl.Resources>
        <vc:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
    </UserControl.Resources>
    <Grid Margin="4">
        <Grid.RowDefinitions>
            <RowDefinition Height="10*" />
            <RowDefinition Height="90*" />
        </Grid.RowDefinitions>
        <TextBlock Style="{StaticResource H1Style}" Text="{Binding Title}" />
        <ScrollViewer Grid.Row="1"
            HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Disabled">
            <ItemsControl
                ItemsSource="{Binding Glyphs}">
                <ItemsControl.ItemsPanel>
                    <ItemsPanelTemplate>
                        <WrapPanel Orientation="Vertical" />
                    </ItemsPanelTemplate>
                </ItemsControl.ItemsPanel>
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <Grid Margin="4">
                            <Grid.RowDefinitions>
                                <RowDefinition />
                                <RowDefinition />
                            </Grid.RowDefinitions>
                            <TextBox
                                Background="Transparent"
                                BorderThickness="0"
                                HorizontalContentAlignment="Center"
                                Text="{Binding EntityDisplayText, Mode=OneWay}"
                                />
                            <Border Grid.Row="1"
                                BorderThickness="2" BorderBrush="DarkGray"
                                MinHeight="96" Padding="4"
                                Width="96" Height="Auto">
                                <Path
                                    Data="{Binding StreamGeometry, Mode=OneWay}"
                                    Fill="Black"
                                    RenderTransformOrigin="0.5,0.5"
                                    Stretch="Uniform">
                                    <Path.RenderTransform>
                                        <ScaleTransform ScaleY="-1" />
                                    </Path.RenderTransform>
                                </Path>
                            </Border>
                        </Grid>
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl>
        </ScrollViewer>
        <TextBlock Grid.Row="1"
            Foreground="{StaticResource AkyinkyinDarkBrush}"
            Text="Loading…"
            Visibility="{Binding IsDoingServiceOperation, Converter={StaticResource BooleanToVisibilityConverter}}"
            />
    </Grid>
</UserControl>
